﻿using System.IO;
using System.Text;
using System.Net;
using System.Xml;

using ECCIT;

namespace ECCIT.Net.SAML2
{
    internal static class XmlHelper
    {
        // Methods
        public static XmlDocument CreateDocument()
        {
            return new XmlDocument { PreserveWhitespace = true, XmlResolver = null };
        }

        public static XmlDocument LoadDocument(string xmlText)
        {
            XmlReaderSettings settings = new XmlReaderSettings
            {
                ProhibitDtd = true,
                XmlResolver = null
            };
            XmlDocument document = CreateDocument();
            using (XmlReader reader = XmlReader.Create(new StringReader(xmlText), settings))
            {
                document.Load(reader);
            }
            return document;
        }
    }
}
